//
// Created by admin on 2023/1/30.
//

#include "error.h"
#include <errno.h>
#include <string.h>
#include "./log.h"

namespace utils {

IoError::IoError(int err) : m_err_msg(strerror(err)) {

}

IoError::IoError() : m_err_msg(strerror(errno)) {

}

const char *IoError::what() const noexcept {
    return m_err_msg;
}

void IoError::print() const noexcept {
    log_e("io err:%s", m_err_msg);
}


IllegalError::IllegalError(const char *msg) : m_err_msg(msg) {}

const char *IllegalError::what() const noexcept {
    return m_err_msg;
}

void IllegalError::print() const noexcept {
    log_e("illegal err:%s", m_err_msg);
}

const char *current_err_msg() {
    return strerror( errno );
}

}























